<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
        <title>Staff Control Panel - Powered By Customer Connect</title>
        <link rel="Shortcut Icon" href="<?php echo Yii::app()->baseUrl; ?>/favicon.ico"/>

        <script>
<?php echo "baseUrl ='" . Yii::app()->baseUrl . "';"; ?>
        </script>
        <?php Yii::app()->clientScript->registerCoreScript('jquery') ?>
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl; ?>/css/admin.css"/>
        <link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/gridsearch.css"/>
        <link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/form.css"/>
        <link type="text/css" rel="stylesheet" href="<?= Yii::app()->baseUrl; ?>/js/fancybox/jquery.fancybox-1.3.4.css"/>
        <link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/extjs/resources/css/ext-all.css"/>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/extjs/ext-all.js"></script>
        <script>
            if (Ext.BLANK_IMAGE_URL.substr(0, 5) != 'data:') {
                Ext.BLANK_IMAGE_URL = 'images/s.gif';
            }
              var timerStart = Date.now();
        </script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/app/model.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/app/StatusBar.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/app/LiveSearchGridPanel.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.easing.1.3.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.hoverIntent.minified.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.bgiframe.min.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/excanvas.compiled.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.qtip-1.0.0-rc3.min.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.bt.min.js"></script>
        <script src="<?= Yii::app()->baseUrl; ?>/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
        <script src="<?= Yii::app()->baseUrl; ?>/js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
        <script src="<?= Yii::app()->baseUrl; ?>/js/jtab.js"></script>
        <script src="<?= Yii::app()->baseUrl; ?>/js/jquery.tabify.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/app/app.js"></script>
        <?php 
            if(Yii::app()->user->isGuest ==false){
                $realName = Yii::app()->user->getModel()->real_name;
                Yii::app()->clientScript->registerScript('login-user-name',"var realName = '$realName';",CClientScript::POS_HEAD);
            }
        ?>

    </head>

    <body class="darkgray">
        <div style="font-weight: bold; color:red; position:absolute;left:110px;top:7px;" id="mainsitenotice"></div>
        <div id="msg-div" class="msg-div-wrapper" style="display:none;"><div id="msg-div-inner" class="msg-div-inner"></div></div>
        <div id="header">
            <div class="smenu">         
                  <?php
                $uid =Yii::app()->user->id;
               
                $this->widget('application.extensions.menu.SMenu', array(
                    'menu' => array(
                        array(
                            'url' => array(
                                'route' => 'site',
                            ),
                            'label' => 'Home',
                            array(
                                'url' => array(
                                    'route' => 'site'
                                ),
                                'label' => 'Dashboard'
                            )
                        ),
                        array(
                            'url' => array(
                                'route' => 'customers',
                            ),
                            'label' => 'Customers',
                             'visible'=>Users::model()->checkPermission('customers', Yii::app()->user->id),
                            array(
                                'url' => array(
                                    'route' => 'customers'
                                ),
                                'label' => 'Customer List',
                                  'visible'=>Users::model()->checkPermission('customers', Yii::app()->user->id)
                            ),
                            array(
                                'label' => 'Contracts',
                                'url' => array('route' => NULL),
                                array(
                                    'label' => 'Contract Center',
                                    'url' => array('route' => 'contractCenter/index'),
                                      'visible'=>Users::model()->checkPermission('contracts/pagelist', Yii::app()->user->id)
                                ),
                                array(
                                    'label' => 'Settings',
                                    'url' => NULL,
                                    array(
                                        'label' => 'Contract Plan Types',
                                        'url' => array('route' => 'plantypes'),
                                          'visible'=>Users::model()->checkPermission('plantypes', Yii::app()->user->id)
                                    ),
                                    array(
                                        'label'=>'Software Maintenance Rates',
                                        'url'=>array('route'=>'softwareMaintRates')
                                    )
                                ),
                            ),
                              array(
                                'url' => NULL,
                                'label' => 'Jobs',                             
                                array(
                                    'url' => array('route' => 'jobscenter'),
                                    'label' => 'Job Center',
                                    'visible'=>Users::model()->checkPermission('jobscenter', Yii::app()->user->id)
                                ),
                                array(
                                    'label' => 'Settings',
                                    'url' => array('route' => NULL),
                                    array(
                                        'label' => 'Job Billing Status',
                                        'url' => array('route' => 'jobsBillingStatus'),
                                         'visible'=>Users::model()->checkPermission('jobsBillingStatus', Yii::app()->user->id)
                                    ),
                                    array(
                                        'label' => 'Job Classes',
                                        'url' => array('route' => 'jobsClass'),
                                            'visible'=>Users::model()->checkPermission('jobsClass', Yii::app()->user->id)
                                    ),
                                    array(
                                        'label' => 'Job Status',
                                        'url' => array('route' => 'jobsStatus'),
                                          'visible'=>Users::model()->checkPermission('jobsStatus', Yii::app()->user->id)
                                    ),
                                ),
                            ),
                        ),
                          array(
                            'url' => array(
                                'route' => 'employees',
                            ),
                            'label' => 'Company',
                            'visible'=>Users::model()->checkPermission('employees', Yii::app()->user->id),
                            array(
                                'url' => array(
                                    'route' => NULL,
                                      'visible'=>Users::model()->checkPermission('employees', Yii::app()->user->id)
                                ),
                                'label' => 'Employees',
                                'visible'=>Users::model()->checkPermission('employees', Yii::app()->user->id),
                                array(
                                    'url' => array(
                                        'route' => 'employees',
                                        
                                    ),
                                    'label' => 'Employees List',
                                    'visible'=>Users::model()->checkPermission('employees', Yii::app()->user->id)
                                ),
                            ),
                            array(
                                'url' => array('route' => NULL),
                                'label' => 'Settings',
                               'visible'=>true,
                                array(
                                    'url' => array(
                                        'route' => 'companyinfo/main/update',
                                        
                                    ),
                                    'label' => 'Company Setup',
                                    'visible'=>Users::model()->checkPermission('companyinfo/main/update', Yii::app()->user->id)
                                ),
                                array(
                                    'url' => array(
                                        'route' => 'empgroup',
                                        
                                    ),
                                    'label' => 'Employee Groups',
                                     'visible'=>Users::model()->checkPermission('empgroup', Yii::app()->user->id)
                                )
                            )
                        ),
                        array(
                            'url'=>array('route'=>null),
                            'label'=>'Dispatch',
                            array(
                                'url'=>array('route'=>'dispatch/newdispatch'),
                                'label'=>'Add Internal Dispatch',
                                'visible'=>Users::model()->checkPermission('dispatch',Yii::app()->user->id)
                            ),
                            array(
                                'url'=>array('route'=>'dispatchboard'),
                                'label'=>'Dispatch Board',
                                'visible'=>Users::model()->checkPermission('dispatchboard',Yii::app()->user->id)
                            ),
                            array(
                                'url'=>array('route'=>'#'),
                                'label'=>'Accounting',
                                array(
                                    'url'=>array('route'=>'dispatch/billedDispatchList'),
                                    'label'=>'Billed Dispatch List',
                                    'visible'=>Users::model()->checkPermission('dispatch',Yii::app()->user->id)
                                )
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Settings',
                                array(
                                    'url' => array('route' => 'dispatchboard/list'),
                                    'label' => 'List Dispatch Boards',
                                    'visible'=>Users::model()->checkPermission('terms', Yii::app()->user->id),
                                ),
                                array(
                                    'url' => array('route' => 'DispatchboardAssignments/index'),
                                    'label' => 'Dispatch Board Assignments',
                                    'visible'=>Users::model()->checkPermission('taxcode', Yii::app()->user->id),
                                ),
			                 ),
                        ),
                        array(
                            'url' => array('route' => 'inventory'),
                            'label' => 'Inventory',
                             'visible'=>Users::model()->checkPermission('inventory', Yii::app()->user->id),
                            array(
                                'url' => array('route' => 'inventory'),
                                'label' => 'Inventory List',
                                'visible'=>Users::model()->checkPermission('inventory', Yii::app()->user->id),
                            ),
                            array(
                                'label'=>'Adjust Inventory',
                                'url'=>array('route'=>'inventory/adjust')
                            ),
                            array(
                                'label'=>'Transfer Inventory',
                                'url'=>array(
                                    'route'=>'inventory/transfer'
                                )
                            ),  array(
                                'url' => array('route' => null),
                                'label' => 'Reports',
                                array(
                                    'url' => array('route' => 'report/inventory/Warehouse/'),
                                    'label' => ' Warehouse Report',
                                    'visible'=>Users::model()->checkPermission('report/inventory/Warehouse/', Yii::app()->user->id),
                                ),
                             
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Settings',
                                array(
                                    'url' => array('route' => 'Warehouse'),
                                    'label' => 'Warehouses',
                                    'visible'=>Users::model()->checkPermission('Warehouse', Yii::app()->user->id),
                                ),
                                array(
                                    'url' => array('route' => 'invcategories'),
                                    'label' => 'Part Categories',
                                    'visible'=>Users::model()->checkPermission('invcategories', Yii::app()->user->id),
                                ),
                            ),
                              
                        ),
                        array(
                            'url' => array(
                                'route' => 'vendors/vendors/',
                            ),
                            'label' => 'Vendors',
                              'visible'=>Users::model()->checkPermission('vendors/vendors', Yii::app()->user->id),
                            array(
                                'url' => array('route' => 'vendors/vendors'),
                                'label' => 'Vendors List',
                                 'visible'=>Users::model()->checkPermission('vendors/vendors', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => 'vendors/po/index'),
                                'label' => 'Purchase Orders',
                                 'visible'=>Users::model()->checkPermission('vendors/po/index', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Settings',
                                array(
                                    'url' => array('route' => 'markupcodes'),
                                    'label' => 'Make Up Codes',
                                    'visible'=>Users::model()->checkPermission('markupcodes', Yii::app()->user->id),
                                ),
                                array(
                                    'url' => array('route' => 'pricebooks'),
                                    'label' => 'Price Books',
                                    'visible'=>Users::model()->checkPermission('pricebooks', Yii::app()->user->id),
                                ),
                                array(
                                    'url' => array('route' => 'mfg'),
                                    'label' => 'Manufacturers',
                                     'visible'=>Users::model()->checkPermission('mfg', Yii::app()->user->id),
                                ),
                            ),
                        ),
                        array(
                            'url' => array('route' => NULL),
                            'label' => 'Accounting',
                            array(
                                'url' => array('route' => 'finLedger'),
                                'label' => 'General Journal',
                                'visible'=>Users::model()->checkPermission('finLedger', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => 'makedeposit'),
                                'label' => 'Make Deposit',
                                 'visible'=>Users::model()->checkPermission('makedeposit', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Payment',
                               
                                array(
                                    'url'=>array('route'=>'payment'),
                                    'label'=>'Receive Payments',
                                    'visible'=>Users::model()->checkPermission('payment', Yii::app()->user->id),
                                ),
                                array(
                                    'url'=>array('route'=>'payment/paymentCenter'),
                                    'label'=>'Payment List',
                                    'visible'=>Users::model()->checkPermission('payment/paymentCenter', Yii::app()->user->id),
                                )
                               
                            ),
                            array(
                                'url' => array('route' => NULL),
                                'label' => 'The register',
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Settings',
                                array(
                                    'label' => 'Account Categories',
                                    'url' => array('route' => 'acctcat'),
                                     'visible'=>Users::model()->checkPermission('acctcat', Yii::app()->user->id),
                                ),
                                array(
                                    'label' => 'Chart Of Account',
                                    'url' => array('route' => 'coa'),
                                    'visible'=>Users::model()->checkPermission('coa', Yii::app()->user->id),
                                ),
                            )
                        ),
                        array(
                            'url' => array('route' => null),
                            'label' => 'Sales',
                            array(
                                'url' => array('route' => 'invoicelist', 'params' => array('type' => Invoice::TYPE_QUOTE)),
                                'label' => 'Quote List',
                                 'visible'=>Users::model()->checkPermission('invoicelist&type=Quote', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => 'invoicelist', 'params' => array('type' => Invoice::TYPE_SALES_ORDERS)),
                                'label' => 'Sales Order List',
                                 'visible'=>Users::model()->checkPermission('invoicelist&type=Sales+Orders', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => 'invoicelist', 'params' => array('type' => Invoice::TYPE_INVOICE)),
                                'label' => 'Invoice List',
                                 'visible'=>Users::model()->checkPermission('invoicelist&type=Invoice', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => 'invoicelist', 'params' => array('type' => Invoice::TYPE_CREDIT_MEMO)),
                                'label' => 'Credit Memo List',
                                 'visible'=>Users::model()->checkPermission('invoicelist&type=Credit+Memo', Yii::app()->user->id),
                            ),
                            array(
                                'url' => array('route' => null),
                                'label' => 'Settings',
                                array(
                                    'url' => array('route' => 'terms'),
                                    'label' => 'Payment Terms',
                                    'visible'=>Users::model()->checkPermission('terms', Yii::app()->user->id),
                                ),
                                array(
                                    'url' => array('route' => 'taxcode'),
                                    'label' => 'Tax codes',
                                    'visible'=>Users::model()->checkPermission('taxcode', Yii::app()->user->id),
                                ),
                            ),
                        ),
                        array(
                            'label' => 'Report',
                            'url' => array('route' => NULL),
			    'visible'=>true,
                            array(
                                'label' => 'Jobs',
                                'url' => array('route' => NULL),
                                  'visible'=>true,
                                array(
                                    'label' => 'Job Report',
                                    'visible'=>Users::model()->checkPermission('report/report', Yii::app()->user->id),
                                    'url' => array('route' => 'report/report')
                                ),
                            ),
                            array(
                                'label' => 'Sales',
                                'url' => array('route' => null),
                                array(
                                    'label'=>'Contracts Earned/UnEarned',
                                    'url'=>array('route'=>'pdf/earnedReportByState'),                                    
                                    'visible'=>Users::model()->checkPermission('pdf/earnedReportByState', Yii::app()->user->id),
                                ),
                                array(
                                    'label' => 'Sales Tax Report',
                                    'url' => array('route' => 'report/report/tax'),
                                    'visible'=>Users::model()->checkPermission('report/report/tax', Yii::app()->user->id),
                                ),
                                array(
                                    'label' => 'Sales Invoice Report',
                                    'url' => array('route' => 'salesreport/invoiceReport'),
                                    'visible'=>Users::model()->checkPermission('salesreport/invoiceReport', Yii::app()->user->id),
                                ),
                                array(
                                    'label'=>'Sales Order Report',
                                    'url'=>array('route'=>'salesreport/salesorderreport'),
                                    'visible'=>Users::model()->checkPermission('salesreport/salesorderreport', Yii::app()->user->id),
                                ),
                                array(
                                    'label'=>'Earned Revenue Report',
                                    'url'=>array('route'=>'pdf/newEarnedRevenueReport'),
                                    'visible'=>Users::model()->checkPermission('pdf/earnedRevenueReport', Yii::app()->user->id),
                                ),

                            ),
                            array(
                                'label'=>'Weekly Report',
                                'url'=>array('route'=>'salesreport/salesreport'),
                               'visible'=>Users::model()->checkPermission('salesreport/salesreport', Yii::app()->user->id),
                            ),
                            array(
                                'label'=>'Contract Report',
                                'url'=>array('route'=>'salesreport/contractreport'),
                                        'visible'=>Users::model()->checkPermission('salesreport/contractreport', Yii::app()->user->id),
                            ),
                            array(
                                'label' => 'System Reports',
                                'url' => array('route' => NULL),
 'visible'=>Users::model()->checkPermission('printLog', Yii::app()->user->id),
                                array(
                                    'label' => 'Invoice Print Log',
                                    'url' => array('route' => 'printLog'),
                                    'visible'=>Users::model()->checkPermission('printLog', Yii::app()->user->id),
                                ),
                            ),
                        ),
                        array(
                            'label' => 'System Setting',
                            'url' => array('route' => null),
                            'visible'=>Users::model()->checkPermission(Users::PRIVILEGE_SYSTEM_MENU, Yii::app()->user->id),
                            array(
                                'label' => 'Users',
                                'url' => array('route' => 'users'),
                                'visible'=>Users::model()->checkPermission('users', Yii::app()->user->id)
                            ),
                            array(
                                'label' => 'Pages Administration',
                                'url' => array('route' => 'pages'),
                                'visible'=>Users::model()->checkPermission('pages', Yii::app()->user->id),
                            ),
                            array(
                                'label' => 'Time Zone',
                                'url' => array('route' => 'timezone'),
                                 'visible'=>Users::model()->checkPermission('timezone', Yii::app()->user->id),
                            ),
                            array(
                                'label' => 'Counters',
                                'url' => array('route' => 'counters'),
                                   'visible'=>Users::model()->checkPermission('counters', Yii::app()->user->id),
                            ),
                            array(
                                'label' => 'Settings',
                                'url' => array('route' => null),
                                array(
                                    'label' => 'Sales Departments',
                                    'url' => array('route' => 'salesDepartments'),
                                    'visible'=>Users::model()->checkPermission('salesDepartments', Yii::app()->user->id),
                                ),
                                array(
                                    'label' => 'Sales Department Categories',
                                    'url' => array('route' => 'salesDepartments'),
                                      'visible'=>Users::model()->checkPermission('salesDepartments', Yii::app()->user->id),
                                )
                            ),
                             array( 
                                'label' => 'QuickBooks',
                                'url' => array('route' => null),
                                array(
                                    'label' => 'Payment Import ',
                                    'url' => array('route' => 'importPayment/qb_paymentsapplied'),
                                    'visible'=>true
                                ),
                             
                            ),
							array(
								'label'=>'Test',
								'url'=>array('route'=>NULL),
								array(
									'label'=>'Customer - City, State, Zipcode',
									'url'=>array('route'=>'taxcode/testcustomer'),
									'visible'=>true
								),
								array(
									'label'=>'Location - City, State, Zipcode',
									'url'=>array('route'=>'taxcode/testlocation'),
									'visible'=>true
								),
                            )
                        )
                    ),
                    'menuID' => 'myMenu',
                        )
                );
                ?>

            </div>
        </div>   
        <div class="user-box">
            <div class="user-box-name">
                <a href="index.php?fuse=admin&amp;view=EditAddAdminAccount">Welcome <?php echo getUserRealname(Yii::app()->user->name) ?></a>

            </div>
            <ul class="user-nav">
                <li>
                    <a id="session_count" class="session_count" href="#">0</a><a
                        id="day_count" class="day_count" href="#"><?php echo Users::getTotalAssignedDispatch(Yii::app()->user->id); ?></a>
                </li>


                <li><a onclick="" qtip="Context Help" href="javascript:void(0);">Help</a></li>
                <li><a href="javascript:void(0)" id="btnLogout">Logout</a></li>
            </ul>
        </div>
        <div class="searchquery">
            <div id="general-search-box"></div>
        </div>
        <!-- change #header h1 to with your logo in main.css -->

        <h1 class="mainlogo"><a href="#"></a></h1>


        <div id="main">


<?php echo $content ?>

        </div> <!-- main -->


        <div id="advancedsearch-win" class="x-hidden">
            <div class="x-window-header">Search Options</div>
            <div id="advancedsearchcontent" class="x-hidden"></div>
        </div>


    </body>
</html>
